.row
  .span3
    .admin-filter
      = form_tag admin_users_path, method: :get, class: 'form-inline' do
        = search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'search-text-input span2'
        = button_tag type: 'submit', class: 'btn' do
          %i.icon-search
      %ul.nav.nav-pills.nav-stacked
        %li{class: "#{'active' unless params[:filter]}"}
          = link_to admin_users_path do
            有效用户
            %small.pull-right= User.active.count
        %li{class: "#{'active' if params[:filter] == "admins"}"}
          = link_to admin_users_path(filter: "admins") do
            管理员
            %small.pull-right= User.admins.count
        %li{class: "#{'active' if params[:filter] == "blocked"}"}
          = link_to admin_users_path(filter: "blocked") do
            已禁用
            %small.pull-right= User.blocked.count
        %li{class: "#{'active' if params[:filter] == "wop"}"}
          = link_to admin_users_path(filter: "wop") do
            没有项目的
            %small.pull-right= User.without_projects.count
      %hr
      = link_to '重设', admin_users_path, class: "btn btn-cancel"

  .span9
    .ui-box
      .title
        Users (#{@users.total_count})
        .pull-right
          = link_to '新建用户', new_admin_user_path, class: "btn btn-new"
      %ul.well-list
        - @users.each do |user|
          %li
            - if user.blocked?
              %i.icon-lock.cred
            - else
              %i.icon-user.cgreen
            = link_to user.name, [:admin, user]
            - if user.admin?
              %strong.cred (Admin)
            - if user == current_user
              %span.cred 这是你哦
            .pull-right
              %span.light
                %i.icon-envelope
                = mail_to user.email, user.email, class: 'light'
              &nbsp;
              = link_to '修改', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-small"
              - unless user == current_user
                - if user.blocked?
                  = link_to '解禁', unblock_admin_user_path(user), method: :put, class: "btn btn-small success"
                - else
                  = link_to '禁用', block_admin_user_path(user), confirm: "您确定要禁用 #{user.name}? Ta的所有项目也被跟着被删除哦", method: :put, class: "btn btn-small btn-remove"
                = link_to '杀了他', [:admin, user], confirm: "真的真的要杀了 #{user.name} 这个用户(账号)吗? 好怕怕, 您最好想清楚了...", method: :delete, class: "btn btn-small btn-remove"
    = paginate @users, theme: "gitlab"
